﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Show : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            try
            {
                object id = Request.QueryString["id"];
                if (id == null)
                {
                    Response.Redirect("Default.aspx");
                }
                else
                {
                    DbAccess db = new DbAccess();
                    DataSet dsProd = db.GetDataSet("select * from PDetail where ProId=" + int.Parse(id.ToString()) + "");
                    if (dsProd.Tables[0].Rows.Count > 0)
                    {
                        Proname.Text = dsProd.Tables[0].Rows[0][1].ToString();//名称
                        lblMarketPrice.Text = dsProd.Tables[0].Rows[0][8].ToString();//市场价格
                        lblMemberPrice.Text = dsProd.Tables[0].Rows[0][7].ToString();//会员价格
                        decimal d = decimal.Parse(dsProd.Tables[0].Rows[0][8].ToString()) - decimal.Parse(dsProd.Tables[0].Rows[0][7].ToString());//计算差价
                        lblCha.Text = d.ToString();
                        lblLb.Text = dsProd.Tables[0].Rows[0][12].ToString();
                        lbDetail.Text = dsProd.Tables[0].Rows[0][2].ToString();//详细信息
                        imgGoods.ImageUrl = dsProd.Tables[0].Rows[0][6].ToString();//图片路径

                    }

                }

            }
            catch
            {

            }
        }
    }
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        Session["Id"] = Request.QueryString["id"].ToString();//商品编号
        Session["Proname"] = this.Proname.Text;//商品名称
        Session["MemberPrice"] = this.lblMemberPrice.Text;//商品单价
        Response.Redirect("buy.aspx");
    }
}
